<?php
function url_phone_cat() {
   return '/dien-thoai/';
}
function url_tablet_cat() {
   return '/may-tinh-bang/';
}
function url_accessories_cat() {
   return '/phu-kien/';
}
function url_services_cat($alias = '') {
   if($alias == '')
      return '/dich-vu/';
   else 
      return '/dich-vu-'.$alias.'/';
}
function url_product_detail($product) {
   if($product['pro_type'] == 1) {
      return '/dien-thoai/' .$product['pro_alias']. '.html';
   }else {
      return '/may-tinh-bang/' .$product['pro_alias']. '.html';
   }
}
function url_accessories_detail($accessories) {
   return '/phu-kien/' .$accessories['acc_alias']. '.html';
}
function url_services_detail($services) {
   return '/dich-vu/' .$services['ser_alias']. '.html';
}
function url_news_detail($news_alias) {
    return '/tin-tuc/' .$news_alias. '.html';
}
function url_tags($tags) {
   $tags = str_replace('%20','+',$tags);
   $tags = str_replace(' ','+',$tags);
   return '/tags/' .$tags. '/';
}

function removeTitle($string,$keyReplace = "/"){
	 $string = removeSign($string);
	 $string  =  trim(preg_replace("/[^A-Za-z0-9]/i"," ",$string)); // khong dau
	 $string  =  str_replace(" ","-",$string);
	 $string = str_replace("--","-",$string);
	 $string = str_replace("--","-",$string);
	 $string = str_replace("--","-",$string);
	 $string = str_replace("--","-",$string);
	 $string = str_replace("--","-",$string);
	 $string = str_replace("--","-",$string);
	 $string = str_replace("--","-",$string);
	 $string = str_replace($keyReplace,"-",$string);
	 return strtolower($string);
}
?>